# 重命名文件
import os
import sys,os
sys.path.append(os.getcwd())
from src.utils.tool import Tool
 
# 设置文件夹路径
folder_path = 'D:/wwwroot/Python/tool/pic'
 
# 遍历文件夹
for filename in os.listdir(folder_path):
    # 构建原文件路径
    old_file_path = os.path.join(folder_path, filename)
    
    # 这里可以编写代码来定义新的文件名
    # 例如将所有文件名转换为小写
    new_filename = filename.lower()

    new_filename = Tool.str_replace(new_filename,'1','')
    new_filename = Tool.str_replace(new_filename,'2','')
    new_filename = Tool.str_replace(new_filename,'3','')
    new_filename = Tool.str_replace(new_filename,'4','')
    new_filename = Tool.str_replace(new_filename,'5','')
    new_filename = Tool.str_replace(new_filename,'6','')
    new_filename = Tool.str_replace(new_filename,'7','')
    new_filename = Tool.str_replace(new_filename,'8','')
    new_filename = Tool.str_replace(new_filename,'9','')
    new_filename = Tool.str_replace(new_filename,'0','')
    
    # 构建新文件路径
    new_file_path = os.path.join(folder_path, new_filename)
    
    # 重命名文件
    os.rename(old_file_path, new_file_path)